class CustomLinkComponent {
  eGui;
  eButton;
  eventListener;

  // params.data.tag == params.value
  // params : {value: '药品|通告公告', valueFormatted: null, getValue: ƒ, setValue: ƒ, formatValue: ƒ, …}
  init(params) {
    // link 组件, 超链接样式

    const parentEl = document.createElement("div");
    parentEl.style.display = "inline-flex";
    parentEl.style.alignItems = "center";
    this.eGui = parentEl;
    const value = params.value;

    const el = document.createElement("a");
    el.className = "cus-link";
    el.textContent = value;
    el.href = value;
    el.target = "_blank";
    el.style.height = "auto";
    // el.style.backgroundColor = "rgb(209, 210, 210, 0.5)";
    el.style.color = "black";
    el.style.cursor = "pointer";
    el.style.textDecoration = "none";
    el.style.padding = "0 5px";
    el.style.margin = "0px 3px";
    el.style.borderRadius = "5px";
    el.style.display = "inline-flex";
    el.style.alignItems = "center";
    el.style.lineHeight = "20px";
    el.style.borderBottom = "1px dashed rgb(209, 210, 210, 0.5)";

    this.eGui.appendChild(el);
  }

  getGui() {
    return this.eGui;
  }

  refresh() {
    return true;
  }

  destroy() {
    if (this.eButton) {
      this.eButton.removeEventListener("click", this.eventListener);
    }
  }
}
